<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    // class A {
    //     contructor(x){//公有属性
    //         this.x = x
    //     }
    //     getX(){//公有方法
    //         console.log(this.x);
    //     }
    // }

    // class B extends A {
    //     contructor(y){
    //         super(y);
    //     }
    //     getY(){
    //         super.getX()
    //     }
    // }

    // let lc = new B(333)
    // console.log(lc);


    class People {
        constructor(name = 'wang') {
            this.name = name;
        }
        eat() {
            console.log(`${this.name}  eat food`)
        }
    }
    //继承父类
    class Woman extends People {
        constructor(name = 'ren') {
            //继承父类属性
            super(name);
        }
        eat() {
            //继承父类方法
            super.eat()
        }
    }
    let wonmanObj = new Woman('xiaoxiami');
    wonmanObj.eat();



    {
        class A {
            contructor(name = 'Frazier') {
                this.name = name;
            }
            gat() {
                console.log(`${this.name} 2021`);
            }
        }

        class B extends A {
            constructor(name = 'XiaoMing') {
                super(name)
            }
            gat() {
                super.gat()
            }
        }
        let arr = new B('ZhenBuShiWo')
        arr.gat()

    }

</script>